#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
using namespace std;

vector<int> nextGreaterElement(vector<int>& nums1, vector<int>& nums2) {
	vector<int> tmp(nums2.size(), -1);
	stack<int> s;
	s.push(0);
	for (int i = 1; i<nums2.size(); i++)
	{
		while (!s.empty() && nums2[i]>nums2[s.top()])
		{
			tmp[s.top()] = nums2[s.top()];
			s.pop();
		}
		s.push(i);
	}
	return tmp;
}


vector<int> nextGreaterElements(vector<int>& nums) {
	vector<int> arr(nums.size(), -1);
	int size = nums.size();
	nums.resize(nums.size() * 2);
	for (int i = 0; i<size; i++)
	{
		nums[i + size] = nums[i];
	}
	for (int i = 0; i<size; i++)
	{
		for (int j = i; j<i + size; j++)
		{
			if (nums[i]<nums[j])
			{
				arr[i] = nums[j];
				break;
			}
		}
	}
	return arr;
}


int main()
{
	vector<int> arr{ 1, 2, 1 };
	vector<int> tmp = nextGreaterElements(arr);
	return 0;
}